package com.woniu.microchargeserver.chargemag.other.property.controller;

import com.woniu.microchargeserver.chargemag.other.property.service.IPropertyService;
import com.woniu.microcommonsserver.entity.OwnerInfoEntity;
import com.woniu.microcommonsserver.param.ResponseMsg;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.print.attribute.standard.Media;
import java.awt.*;

/**物业微服务的controller
 * @author: hejie
 * @date: 2021/2/2 5:54
 * @description:
 */
@RestController
@RequestMapping("/property")
public class PropertyController {

    @Resource
    private IPropertyService propertyServiceImpl;

    /**
     * 根据 房间id，查询它的业主
     * @param sid 房间id
     * @return
     */
    @GetMapping(value = "/findOwerBySid", produces = {"application/json;charset=utf-8"})
   public ResponseMsg findOwerBySid(Long sid){
        System.out.println("sid="+sid);
        OwnerInfoEntity ownerInfoEntity= propertyServiceImpl.findOwerBySid(sid);
        return new ResponseMsg(200, "查询成功", ownerInfoEntity);
    }

    /**
     * 根据 房间id，查询它的业主id
     * @param sid
     * @return
     */
    @GetMapping(value = "/findOwerIdBySid", produces = {"application/json;charset=utf-8"})
    public ResponseMsg findOwerIdBySid(Long sid){
        System.out.println("sid="+sid);
        Long owerId= propertyServiceImpl.findOwerIdBySid(sid);
        return new ResponseMsg(200, "查询成功", owerId);
    }

    /**
     * 根据 业主id，查询业主名字
     * @param id
     * @return
     */
    @GetMapping(value = "/findOwerNameById", produces = {"application/json;charset=utf-8"})
    public ResponseMsg findOwerNameById(Long id){
        System.out.println("id="+id);
        String owername= propertyServiceImpl.findOwerNameById(id);
        return new ResponseMsg(200, "查询成功", owername);
    }
}
